local ty_1v2_yc = fk.CreateSkill {
    name = "ty_1v2_yc&",
}

Fk:loadTranslationTable {
    ["ty_1v2_yc&"] = "颍川",
    [":ty_1v2_yc&"] = "当有角色的判定牌生效后，你摸一张牌；你于回合内首次使用一种类型的牌时，你可以进行一次判定，若为红桃，你可以对自己造成一点伤害。",


    ["@ty_1v2_yc-turn"] = "颍川",
}
ty_1v2_yc:addEffect(fk.FinishJudge, {
    anim_type = "drawcard",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(ty_1v2_yc.name)
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
        player:drawCards(1, ty_1v2_yc.name)
    end,
})

ty_1v2_yc:addEffect(fk.CardUseFinished, {
    can_refresh = function(self, event, target, player, data)
        local mark = player:getTableMark("@ty_1v2_yc-turn")
        return player:hasSkill(ty_1v2_yc.name) and target == player and
            not table.contains(mark, data.card:getTypeString() .. "_char") --返回卡牌类型首个字
    end,
    on_refresh = function(self, event, target, player, data)
        player.room:addTableMarkIfNeed(player, "@ty_1v2_yc-turn", data.card:getTypeString() .. "_char")
    end,
})

ty_1v2_yc:addEffect(fk.CardUsing, {
    anim_type = "defensive",
    can_trigger = function(self, event, target, player, data)
        local mark = player:getTableMark("@ty_1v2_yc-turn")
        return target == player and player:hasSkill(ty_1v2_yc.name) and
            not table.contains(mark, data.card:getTypeString() .. "_char")
    end,
    on_cost = function(self, event, target, player, data)
        return player.room:askToSkillInvoke(player, {
            skill_name = ty_1v2_yc.name,
            prompt = "颍川：是否进行一次判定？"
        })
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local judge = {
            who = player,
            reason = self.name,
            pattern = ".|.|heart"
        }
        room:judge(judge)
        if judge:matchPattern() then
            if room:askToSkillInvoke(player, {
                    skill_name = ty_1v2_yc.name,
                    prompt = "颍川：是否对自己造成一点伤害？"
                }) then
                room:damage({
                    from = player,
                    to = player,
                    damage = 1,
                    damageType = fk.NormalDamage,
                    skillName = ty_1v2_yc.name
                })
            end
        end
    end,
})
return ty_1v2_yc
